import requests
#1.获取单张图片
# url='https://p1.music.126.net/KWLjDxVq_AD7LLDhv5XS9A==/109951170018650901.jpg?imageView&quality=89'
# headers={
#     'User-Agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/129.0.0.0'
# }
# res = requests.get(url,headers=headers)
# with open('网易云.jpg','wb') as f:
#     f.write(res.content)
#2.获取单首歌
# url='https://m801.music.126.net/20241006230414/7a793cc8412d80b1f91c98ee4aa8f568/jdyyaac/obj/w5rDlsOJwrLDjj7CmsOj/29646398409/c158/bfab/355d/b66aa79c547fffc5af6aa9523646621f.m4a'
# res2 = requests.get(url)

# with open('网易云.mp3','wb') as f:
#     f.write(res2.content)
#3.获取单个mv
# url='https://vodkgeyttp8.vod.126.net/cloudmusic/MSIlICAgIDAgICA0MCAkNA==/mv/5383219/e864aeb2fa2c534f2c5bc75865fad088.mp4?wsSecret=b0b800e8c78abb95262b1b726b09e850&wsTime=1728225985'
# res3 = requests.get(url)

# with open('网易云.mp4','wb') as f:
#     f.write(res3.content)
#4.贴吧单页获取
# url='https://tieba.baidu.com/f?ie=utf-8&kw=%E6%9D%8E%E6%AF%85'
# headers={
#     'User-Agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/129.0.0.0'
# }
# res = requests.get(url,headers=headers)
# with open('liyi.html','wb') as f:
#      f.write(res.content)
#1.post请求:登录注册
#requests.post(url,data)
#金山翻译
# import json
# url='https://ifanyi.iciba.com/index.php?c=trans'

# headers={
#     'User-Agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/129.0.0.0'
# }
# word=input('请输入你要翻译的内容：')

# post_data={
#     'from':'zh',
#     'to':'en',
#     'q':word
# }
# res=requests.post(url,headers=headers,data=post_data)
# print(res.text)
# #解析数据
# dic=json.loads(res.text)
# print(dic['out'])
#代理
# ip地址：精确定位
# import requests
# url='https://www.baidu.com/'
# headers={
#      'User-Agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/129.0.0.0'
#  }
# proxies={
#     'http':'12.34.56.79:9527'
# }
# res=requests.get(url,headers=headers,proxies=proxies)
# print(res.content.decode())

# 代理ip无效，会使用本机ip
#拉勾网
#获取城市名
# import json
# from jsonpath import jsonpath # type: ignore
# url='https://lagou.com/lbs/getAllCitySearchLabels.json'
# headers={
#       'User-Agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/129.0.0.0'
# }
# res=requests.get(url,headers=headers)
# # print(res.text)
# res2=json.loads(res.text)
# city_name=jsonpath(res2,'$..name')
# print(city_name)







#1.分析
#进入起点中文网-月票榜-抓包
